import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { SystemConfigService } from '@core/services/system-config.service';

@Component({
  selector: 'app-role-set',
  templateUrl: './role-set.component.html',
  styleUrls: ['./role-set.component.less']
})
export class RoleSetComponent implements OnInit {

  public roleLists : any;
  public radioValue : any;
  constructor(private systemService: SystemConfigService) { }

  submit(){
    this.systemService.updateCurrentDefault(this.radioValue).then((data: any) => {

    }, data => {
    })
  }

  ngOnInit() {
    this.systemService.getpersonInfo().then((data: any) => {
      this.roleLists = data.data.roles;
      for(let i=0;i<this.roleLists.length;i++){
        if(this.roleLists[i].isDefault==1){
          this.radioValue = this.roleLists[i].id;
          return
        }
      }
    }, data => {
    })
  }

}
